home *** CD-ROM | disk | FTP | other *** search
/ Clickx 23 / Clickx 23.iso / DATA / BLENDE~1.ZIP / blender-2.37a-OSX-10.2-powerpc / plugins / bmake < prev    next >
Encoding:
Text File  |  2005-06-15  |  3.4 KB  |  147 lines

  1. #!/bin/sh
  2. #
  3. # $Id: bmake,v 1.6 2004/12/27 19:28:48 ton Exp $
  4. #
  5. # ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version. The Blender
  11. # Foundation also sells licenses for use in proprietary software under
  12. # the Blender License.  See http://www.blender.org/BL/ for information
  13. # about this.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program; if not, write to the Free Software Foundation,
  22. # Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  23. #
  24. # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  25. # All rights reserved.
  26. #
  27. # The Original Code is: all of this file.
  28. #
  29. # Contributor(s): none yet.
  30. #
  31. # ***** END GPL/BL DUAL LICENSE BLOCK *****
  32.  
  33. # detect the system
  34.  
  35. UNAME=`uname`
  36. EXT="so";
  37. if ( test "WIN32" = "$TARGET" ) then
  38.         CC="gcc";
  39.         CFLAGS="-funsigned-char -O2";
  40.  
  41.         LD="ld";
  42.         LDFLAGS="-Bshareable -lm";
  43. elif ( test $UNAME = "IRIX64" -o $UNAME = "IRIX" ) then
  44.     CC="cc";
  45.     CFLAGS="-KPIC -O2 -mips3";
  46.  
  47.     LD="ld";
  48.     LDFLAGS="-shared -U";    
  49. elif ( test $UNAME = "FreeBSD" ) then
  50.     CC="gcc";
  51.     CFLAGS="-fPIC -funsigned-char -O2";
  52.  
  53.     LD="ld";
  54.     LDFLAGS="-Bshareable";
  55. elif ( test $UNAME = "OpenBSD" ) then
  56.     CC="gcc";
  57.     CFLAGS="-fPIC -funsigned-char -O2";
  58.  
  59.     LD="ld";
  60.     LDFLAGS="-Bshareable";
  61. elif ( test $UNAME = "Linux" ) then
  62.     CC="gcc";
  63.     CFLAGS="-fPIC -funsigned-char -O2";
  64.  
  65.     LD="ld";
  66.     LDFLAGS="-Bshareable";
  67. elif ( test $UNAME = "SunOS" ) then
  68.     CC="cc";
  69.     CFLAGS="-O";
  70.  
  71.     LD="ld";
  72.     LDFLAGS="-r";
  73. elif ( test $UNAME = "Darwin" ) then
  74.         CC="cc";
  75.         CFLAGS="-fPIC -funsigned-char -O2 -fno-common";
  76.         LD="cc";
  77.         LDFLAGS="-flat_namespace -bundle -bundle_loader ../../blender.app/Contents/MacOS/blender -lm";
  78.         EXT="so";
  79. fi
  80.  
  81. if ( test "$#" = "1" ) then 
  82.     if ( test -f $1 ) then
  83.         BASE_FILE=`echo $1 | sed -e "1 s/\.c//g"`;
  84.     else 
  85.         BASE_FILE=$1;
  86.     fi
  87.  
  88.     CFILE="$BASE_FILE.c"
  89.     OFILE="$BASE_FILE.o"
  90.     SOFILE="$BASE_FILE.$EXT"
  91. else 
  92.     if ( test -f $1$2 ) then
  93.         BASE_FILE=`echo $2 | sed -e "1 s/\.c//g"`;
  94.     else 
  95.         BASE_FILE=$2;
  96.     fi
  97.  
  98.     CFILE="$1$BASE_FILE.c"
  99.         if (test "$TARGET" = "WIN32" ) then
  100.                 DLLFILE="$BASE_FILE.dll";
  101.         fi
  102.     OFILE="$BASE_FILE.o"
  103.     SOFILE="$BASE_FILE.$EXT"
  104. fi
  105.  
  106. INCLUDES=
  107. if ( test -f plugin.h ) then
  108.     INCLUDES=-I.;
  109. elif ( test -f "include/plugin.h" ) then
  110.     INCLUDES=-Iinclude/
  111. elif ( test -f "../plugin.h" ) then
  112.     INCLUDES=-I..;
  113. elif ( test -f "../include/plugin.h" ) then
  114.     INCLUDES=-I../include
  115. else 
  116.     echo "Couldn't find plugin.h";
  117.     exit;
  118. fi
  119.  
  120. LIBM=`fgrep "#include <math.h>" $CFILE`
  121. LIBC=`fgrep "#include <std" $CFILE`
  122.  
  123. LIBS=
  124.  
  125. if ( test -n "$LIBM" ) then
  126.     LIBS="$LIBS -lm"; 
  127. fi
  128. if ( test -n "$LIBC" ) then 
  129.     LIBS="$LIBS -lc"; 
  130. fi
  131.  
  132. echo "$CC $CFLAGS -c $CFILE $INCLUDES"
  133. $CC $CFLAGS -c $CFILE $INCLUDES
  134.  
  135. if ( test "$?" != "0") then 
  136.     echo "Compile error"; 
  137.     exit;
  138. fi
  139.  
  140. echo "$LD $LDFLAGS $OFILE -o $SOFILE $LIBS"
  141. $LD $LDFLAGS $OFILE -o $SOFILE $LIBS
  142.  
  143. if ( test "$?" != "0") then 
  144.     echo "Link error"; 
  145.     exit;
  146. fi
  147.